/**
 * 
 */
var Utils = {
	contextPath : "",
	memberActionUrl : "/member",
	productActionUrl : "/products",
	jboxStyle : {
		border : 3,
		inco : "info",
		height : 120,
		width : 350,
		timeout : 10000,
		title : "温馨提示"
	},
	webType : "jhtml",
	alertCallLine : function() {
		$.jBox.info("请拨打客户服务热线95533，听到语音后按#056，将有专席为您服务!", "温馨提示", {
			timeout : 3000
		});
	},
	alertMsg : function() {
		$.jBox.info("该功能即将推出，敬请期待，谢谢关注！", "温馨提示", Utils.jboxStyle);
	},

	alertInfo : function(msg) {
		$.jBox.info(msg, "温馨提示", Utils.jboxStyle);
	},

	prompt : function(msg) {
		$.jBox.info(msg + "即将推出，敬请期待，谢谢关注！", "温馨提示", 3000, Utils.jboxStyle);
	},
	
	still : function(msg) {
		$.jBox.info(msg, "温馨提示", {
			timeout : 10000
		});
	},

	loadingMsg : function(msg) {
		$.jBox.tip(msg, 'loading');
	},

	alertMessage : function(msg, merchantId) {
		$.jBox.message(msg, "温馨提示", 0, {
			languageDefaults : {
				close : '关闭', /* 窗口右上角关闭按钮提示 */
				ok : '是', /* $.jBox.prompt() 系列方法的“是”按钮文字 */
				cancel : '否' /*$.jBox.confirm() 和 $.jBox.warning() 方法的“否”按钮文字*/
			},
			submit : function(v, h, f) {
				if (v == "cancel") {
					return true;
				}
				window.open(Utils.memberActionUrl
						+ "/addInstationMsg.jhtml?menuType=7_6&merchantId="
						+ merchantId);
			}
		});
	},
	
	alertSubsidy : function(msg) {
		$.jBox.messageSubsidy(msg, "温馨提示-活动须知", 0,{
			width : 450,
			height : 300,
			languageDefaults : {
				close : '关闭', /* 窗口右上角关闭按钮提示 */
				ok : '接受并购买', /* $.jBox.prompt() 系列方法的“是”按钮文字 */
				cancel : '不同意' /* $.jBox.confirm() 和 $.jBox.warning() 方法的“否”按钮文字*/
			},
			submit : function(v, h, f) {
				if (v == "cancel") {
					return true;
				}
				$("form").submit();
			}
		});
	},
	
	signSubsidy:function(subsidyPromotionId){
		var html ="";
		$.post(Utils.contextPath + "/products/subsidy_getSubsidyDetail."+Utils.webType+"?subsidyPromotionId="
				+ subsidyPromotionId, function(data) {
						html = data.result;
						
						$.jBox.messageSubsidy(html, "温馨提示-活动须知", 0,{
							width : 450,
							height : 300,
							languageDefaults : {
								close : '关闭', /* 窗口右上角关闭按钮提示 */
								ok : '接受并购买', /* $.jBox.prompt() 系列方法的“是”按钮文字 */
								cancel : '不同意' /* $.jBox.confirm() 和 $.jBox.warning() 方法的“否”按钮文字*/
							},
							submit : function(v, h, f) {
								if (v == "cancel") {
									return true;
								}
								$("form").submit();
							}
						});
						
//						$.jBox(html, { title: "温馨信息提示", submit: submit,buttons: { '接受并购买': 1, '不同意': 0 } });
					},"json");
		
		var submit = function (v, h, f) {
			    if (v == '1'){
				try {
						$("form").submit();
	    			}catch(e){
	    				$.jBox.closeTip();
	    				$.jBox.info(e.description, "温馨提示 - 活动须知");
	    			}
	    			return false; 
			   }
			    return true;
			};
	},

	urgeShipments : function(orderId){
		
		$.jBox.message("您确定要提醒商户尽快发货吗？每个订单只有三次提醒商户发货的机会!", "温馨提示", 0, {
			languageDefaults : {
				close : '关闭', /* 窗口右上角关闭按钮提示 */
				ok : '确定', /* $.jBox.prompt() 系列方法的“是”按钮文字 */
				cancel : '取消' /*$.jBox.confirm() 和 $.jBox.warning() 方法的“否”按钮文字*/
			},
			submit : function(v, h, f) {
				if (v == "cancel") {
					return true;
				}
				$.jBox("post:"+Utils.contextPath + Utils.memberActionUrl + "/urgeShipments." + Utils.webType + "?orderId=" + orderId,
						function() {
					
							$.jBox.info("催促发货提醒发送成功!", "商城温馨信息提示",Utils.jboxStyle);
							$.post(Utils.contextPath + Utils.memberActionUrl + "/memberOrder." + Utils.webType + "?menuType=2_1");
					
				});
			}
		});
	},
	
	urgeShipmentsTwo : function(orderId) {
		try {

			var html = "<div style='padding:10px;valign:middle'>您确定要提醒商户尽快发货吗？每个订单只有三次提醒商户发货的机会!</div>";
			var submit = function(v, h, f) {
				if(v == 0){
				$("#" + orderId).html("正在发送 ···");
				$("#" + orderId).attr("href","#");
				$.post(Utils.contextPath + Utils.memberActionUrl + "/urgeShipments." + Utils.webType + "?orderId=" + orderId,
						function() {
						
								$.jBox.info("催促发货提醒发送成功!", "商城温馨信息提示",Utils.jboxStyle);
								location.href=Utils.contextPath + Utils.memberActionUrl + "/memberOrder." + Utils.webType + "?menuType=2_1&orderStatus=03&&orderTime=";
								
						});
				}else{
					return true;
				}
			};
			$.jBox(html, {
				"title" : "",
				submit : submit,
				buttons:{"确定" : 0, "取消" : -1}
			}, Utils.jboxStyle);
		} catch (e) {
			$.jBox.info(e.description, "商城温馨信息提示", Utils.jboxStyle);
		}
	},
	
	/**
	 * 检查用户登录状态，如果未登录显示登录界面
	 */
	checkUser : function(loginUrl) {
		try {
			var cookieValue = Utils.getCookie("ccb-main");
			var ccbCookieValue = Utils.getCookie("custName");
			if (!cookieValue || !ccbCookieValue) {

				$.jBox("iframe:" + loginUrl + "&minLogin=1", {
					title : "建设银行统一登录认证平台",
					width : 475,
					height : 380,
					iframeScrolling : 'no',
					buttons : {}
				});
				return false;
			} else {
				var cookieJson = jQuery.parseJSON(cookieValue);
				if (!cookieJson.userid || cookieJson.userid == "") {
					$.jBox("iframe:" + loginUrl, {
						title : "建设银行统一登录认证平台",
						width : 650,
						height : 380,
						buttons : {}
					});
					return false;
				}
			}
			return true;
		} catch (e) {
			alert(e.description);
		}
	},
	closeLogin : function() {
		try {
			jQuery.jBox.close(true);
			commhead.window.location.reload();
			//location.reload();
		} catch (e) {
			alert(e.description);
		}
	},
	
	setCookie : function(cookieName, cookieValue, date, domain) {
		var now = new Date();
		var expire = new Date();
		if (date == null || date == 0) {
			date = 1;
		}
		expire.setTime(now.getTime() + 3600000 * 24 * date);
		document.cookie = cookieName + '=' + encodeURI(cookieValue, "utf-8")
				+ ';expires=' + expire.toGMTString() + ';domain=' + domain
				+ ';path=/';
	},
	getCookie : function(cookieName) {
		var prefix = cookieName + "=";
		var start = document.cookie.indexOf(prefix);

		if (start == -1) {
			return null;
		}

		var end = document.cookie.indexOf(";", start + prefix.length);
		if (end == -1) {
			end = document.cookie.length;
		}

		var value = document.cookie.substring(start + prefix.length, end);
		return decodeURIComponent(value);
	},
	clearCookie : function(cookieName, domain) {
		if (Utils.getCookie(cookieName)) {
			var exp = new Date();
			exp.setTime(exp.getTime() - 3600000 * 24 * 1);
			document.cookie = cookieName + '=' + cookieName + '; domain='
					+ domain + '; expires=' + exp.toGMTString() + ';path=/';
		}
	},
	isNum : function(input) {
		input = input.replace(/^\s*|\s*$/g, "");
		if (isNaN(Math.round(input))) {
			return false;
		} else {
			return true;
		}
	},
	isInteger : function(input) {
		if (Utils.isNum(input) && input.indexOf(".") == -1) {
			return true;
		}
		return false;
	},
	/**
	 * 取到checkboxName已经选择的对象
	 * 
	 * @param checkboxName
	 * @returns {Array}
	 */
	getCheckedObj : function(checkboxName) {
		var sis = document.getElementsByName(checkboxName);
		var values = [];
		var cnt = 0;

		if (sis.length) {
			for ( var i = 0; i < sis.length; i++) {
				var e = sis[i];
				if ((e.type == 'checkbox' && e.checked)
						|| (e.type == 'radio' && e.checked))
					values[cnt++] = e;
			}
		}

		return values;
	},

	/**
	 * 复选框全选/取消
	 * 
	 * @param ochk
	 *            被点击的复选框
	 * @param sis
	 *            被全选/取消的复选框名称, 缺省为"pks"
	 */
	selectAll : function(ochk, sis) {
		if (sis == null) {
			sis = document.getElementsByName("pks");
		} else {
			sis = document.getElementsByName(sis);
		}

		if (sis == null)
			return;

		if (sis.length) {
			for ( var i = 0; i < sis.length; i++) {
				if (sis[i].type == 'checkbox') {
					sis[i].checked = ochk.checked;
				}
			}
			return sis;
		} else {
			if (sis.type == 'checkbox') {
				sis.checked = ochk.checked;
			}
			return sis;
		}
	},

	/**
	 * 重置checkbox选择操作
	 * 
	 * @param sis
	 */
	resetCheckbox : function(sis) {
		if (sis) {
			sis = document.getElementsByName(sis);
		}
		if (sis == null)
			return;
		if (sis.length) {
			for ( var i = 0; i < sis.length; i++) {
				if (sis[i].type == 'checkbox') {
					sis[i].checked = false;
				}
			}
		} else {
			if (sis.type == 'checkbox') {
				sis.checked = false;
			}
		}
	},

	/**
	 * 根据表ID与行ID删除行信息
	 */
	deleteTableTr : function(tableId, trId) {
		var tableObj = document.getElementById(tableId);
		if (tableObj) {
			var trObj = document.getElementById(trId);
			if (trObj) {
				tableObj.deleteRow(trObj.rowIndex);
			}
		}
	},

	/**
	 * 清除表格内容
	 */
	clearData : function(obj) {
		var tableRows = obj.rows;
		for ( var i = 0; i < tableRows.length;) {
			if (tableRows[i].id != "-1") {
				var nowRowIndex = tableRows[i].rowIndex;
				obj.deleteRow(nowRowIndex);
				tableRows = obj.rows;
				i = 0;
				continue;
			} else {
				i++;
			}
		}
	},
	/**
	 * 检查输入串的有效性
	 * 
	 * @param email
	 * @returns {Boolean}
	 */
	checkEmail : function(email) {
		if (email.length > 255) {
			alert("E-mail输入不能超出255个字符");
			return false;
		}

		if (!(email.indexOf("@") > 0 && email.indexOf(".") > 1)) {
			alert("请输入合法的Email");
			return false;
		}

		if (email.indexOf("@", email.indexOf("@") + 1) > 0) {
			alert("请输入合法的Email");
			return false;
		}

		var strarray = new Array("@@", "@.", "..", "/", ",");
		for ( var i = 0; i < strarray.length; i++) {
			if (email.indexOf(strarray[i]) > 0) {
				alert("请输入合法的Email");
				return false;
			}

		}

		return true;
	},

	/**
	 * 自动按时间倒计时打开跳转页面
	 */
	autoOpen : function(url, seconds, tip) {
		var tipTitle = $("#" + tip);
		tipTitle.html(seconds);
		if (seconds == 0) {
			window.location.href = url;
		} else {
			setTimeout("Utils.autoOpen('" + url + "'," + (seconds - 1) + ",'"
					+ tip + "');", 1000);
		}
	},

	/**
	 * 选择全部后计费
	 * 
	 * @param ochk
	 * @param sis
	 */
	getSelectedAll : function(ochk, sis) {
		Utils.selectAll(ochk, sis);
		Utils.getSelectedFees(sis);
	},

	/**
	 * 根据选择项计费
	 * 
	 * @param checkboxName
	 */
	getSelectedFees : function(checkboxName) {
		var selectedObj = Utils.getCheckedObj(checkboxName);
		var submitObj = $("#" + checkboxName + "_submit");
		if (submitObj) {
			if (selectedObj.length <= 0) {
				submitObj.attr("disabled", "disabled");
				submitObj.attr("class", "go_settlement_button_disabled");
			} else {
				submitObj.removeAttr("disabled");
				submitObj.attr("class", "go_settlement_button");
			}
		}
		if (checkboxName) {
			var totalFees = 0.00;
			var totalNum = 0;
			for ( var i = 0; i < selectedObj.length; i++) {
				var feesObj = $("#" + selectedObj[i].id + "_value");
				if (feesObj) {
					totalFees += parseFloat(feesObj.html());
				}
				var numObj = $("#amt_" + selectedObj[i].id);
				if (numObj) {
					totalNum += parseInt(numObj.val());
				}
			}
			var unitFees = $("#" + checkboxName + "_totalPay");
			if (unitFees) {
				unitFees.html(totalFees.toFixed(2));
			}
			var unitTotal = $("#" + checkboxName + "_total");
			if (unitTotal) {
				unitTotal.html(totalNum);
			}
		}
	},
	getRemainTime : function(sTime, sysSecond, textId) {
		if (sysSecond > 0 && sTime == 0) {
			var second = Math.floor(sysSecond % 60); // 计算秒
			second = second < 10 ? "0" + second : second;
			var minite = Math.floor((sysSecond / 60) % 60); // 计算分
			minite = minite < 10 ? "0" + minite : minite;
			// var hour = Math.floor((sysSecond / 3600) % 24); // 计算小时
			var hour = Math.floor(sysSecond / 3600); // 计算小时
			// var day = Math.floor((sysSecond / 3600) / 24); // 计算天
			$("#" + textId).html(
					"离结束剩余<strong>" + hour + "</strong>小时<strong>" + minite
							+ "</strong>分<strong>" + second + "</strong>秒");
			sysSecond = sysSecond - 1;
			setTimeout("Utils.getRemainTime(" + sTime + "," + sysSecond + ",'"
					+ textId + "');", 1000);
		} else if (sysSecond > 0 && sTime > 0) {
			// 活动开始前，显示活动开始时间
			var second = Math.floor(sTime % 60); // 计算秒
			second = second < 10 ? "0" + second : second;
			var minite = Math.floor((sTime / 60) % 60); // 计算分
			minite = minite < 10 ? "0" + minite : minite;
			var hour = Math.floor(sTime / 3600); // 计算小时
			// var hour = Math.floor((sTime / 3600) % 24); // 计算小时
			// var day = Math.floor((sTime / 3600) / 24); // 计算天
			$("#" + textId).html(
					"离开始剩余<strong>" + hour + "</strong>小时<strong>" + minite
							+ "</strong>分<strong>" + second + "</strong>秒");
			sTime = sTime - 1;
			setTimeout("Utils.getRemainTime(" + sTime + "," + sysSecond + ",'"
					+ textId + "');", 1000);
		} else {// 剩余时间小于或等于0的时候，
			$("#" + textId).html("已经结束...");
		}
	},
	getSysRemainTime : function(startTime, endTime, sysSecond, textId) {
		$.getJSON(Utils.contextPath
				+ '/InvokeServlet?methodName=GetLeftTime&startTime='
				+ startTime + '&endTime=' + endTime, function(data) {
			var result = data.result;
			var sTime = data.sTime;
			Utils.getRemainTime(sTime, result, textId);
		}, "json");
	},
	initMallAccount : function() {
		try {
			top.$.jBox.tip("正在跳转到商城账户，请稍候...", 'loading');
			$.post(Utils.memberActionUrl + "/memberMallAccount."
					+ Utils.webType, {}, function(result) {
				Utils.goToMallAccount(result);
			}, "json");
		} catch (e) {
			top.$.jBox.closeTip();
			top.$.jBox.info(e.description, "温馨提示", Utils.jboxStyle);
		}
	},
	goToMallAccount : function(result) {
		try {
			if (result.resultCode == "9") {
				top.$.jBox.closeTip();
				top.$.jBox.info("商城账户目前繁忙，请稍候再试...", "温馨提示",
						OrderUtils.jboxStyle);
			} else {
				// var formObj = $("#mallAccount");
				var formObj = document.getElementById("mallAccount");
				if (!formObj) {
					formObj = commhead.document.getElementById("mallAccount");
					if (!formObj) {
						$.jBox.closeTip();
						return;
					}
				}
				formObj.action = result.url;
				formObj.ccbParam.value = result.encode;
				formObj.submit();
			}
		} catch (e) {
			top.$.jBox.closeTip();
			top.$.jBox.info(e.description, "温馨提示", OrderUtils.jboxStyle);
		}
	},
	countMerchnatBrowse : function(productId, merchantId) {
		try {
			var param = {
				"merchantStoreProd.merchantId" : merchantId,
				"merchantStoreProd.prodId" : productId,
				"merchantStoreProd.browserAmt" : "1"
			};
			$.post(Utils.productActionUrl + "/countMerchnatBrowse."
					+ Utils.webType, param, "", "json");
		} catch (e) {

		}
	},

	/**
	 * 根据参数取商品区域库存
	 * 
	 * @param areaId
	 * @param areaName
	 * @param merchantProdId
	 * @param merchantId
	 */
	getProdStore : function(areaId, areaName, merchantProdId, merchantId) {
		try {
			var haierAreaId=$("#haierAreaId");
			if(haierAreaId){
				haierAreaId.val(areaId);
			}
			
			//判断是否为SKU商品
			var skuId=document.getElementById("shopCar.skuId").value;
			if(skuId!=""){
				merchantProdId=skuId;
			}
			
			var targetObj = $("#selectedAreaId");
			if (targetObj) {
				targetObj.html(areaName);
			}
			var targetImage = $("#prodStorageTip");
			var img = "<img src='"
					+ Utils.contextPath
					+ "/public/images/jbox/jbox-loading2.gif' width='15' height='15' border='0'/>";
			targetImage.html(img + "件");
			$.post(Utils.contextPath
					+ '/InvokeServlet?methodName=GetProdStorage&areaId='
					+ areaId + '&prodId=' + merchantProdId + "&merchantId="
					+ merchantId, function(data) {
				var html = "0";
				if (data.resultCode == "0") {
					html = data.result;
				}

				var targetObj = $("#prodStorageTip");
				if (targetObj) {
					if (html != "0") {
						targetObj.html(html + "件");
					} else {
						targetObj.html("缺货");
					}
					$("#prodStorage").val(html);
				}
			}, "json");
		} catch (e) {
		}
	},
	/**
	 * 根据参数取商品区配送费用
	 * 
	 * @param areaId
	 * @param areaName
	 * @param merchantProdId
	 * @param merchantId
	 */
	getProdDeliveryFee : function(areaId, areaName, merchantProdId, merchantId) {
		try {
			var targetObj = $("#selectedAreaIdF");
			if (targetObj) {
				targetObj.html(areaName);
			}
			var deliveryFeeResult = $("#deliveryFeeResult");
			var img = "<img src='"
					+ Utils.contextPath
					+ "/public/images/jbox/jbox-loading2.gif' width='15' height='15' border='0'/>";
			deliveryFeeResult.html(img + "正在查询运费...");
			
			var prodPriceByone=$('#prodPriceByone').val();
			if($('#flashSaleProdPrice').length>0){
				prodPriceByone=$('#flashSaleProdPrice').val();
			}
			
			$.post(Utils.contextPath
					+ '/InvokeServlet?methodName=GetProdDeliveryFee&areaId='
					+ areaId + '&prodId=' + merchantProdId + "&merchantId="
					+ merchantId + '&prodPrice=' + prodPriceByone, function(data) {
				var targetObj = $("#deliveryFeeResult");
				if (data.resultCode == "0") {
					targetObj.html(data.resultSet);
				}else{
					targetObj.html("查询失败,请稍后再试.");
				}
			}, "json");
		} catch (e) {
		}
	},

	/**
	 * 根据区域编号取下级区域数据
	 * 
	 * @param pid
	 * @param merchantProdId
	 * @param merchantId
	 */
	getSubAddress : function(pid, merchantProdId, merchantId, subTip,
			subMethod) {
		try {
			if (pid != "-1") {
				$.post(Utils.contextPath
						+ '/ZipUtilsServlet?type=staticmode&zipId=' + pid,
						function(data) {
							var resultList = data.resultSet;
							var html = "";
							if(subMethod==null||subMethod==""){
								subMethod="Utils.getProdStore";
							}
							for ( var i = 0; i < resultList.length; i++) {
								html += "<li onclick=\"" + subMethod + "(\'"
										+ resultList[i].id + "\',\'"
										+ resultList[i].name + "\',\'"
										+ merchantProdId + "\',\'" + merchantId
										+ "\');\">" + resultList[i].name
										+ "</li>";
							}
							if(subTip==null||subTip==""){
								subTipe="subSelectedArearId";
							}
							var targetObj = $("#" + subTip);
							if (targetObj) {
								targetObj.html(html);
							}
						}, "json");
			}
		} catch (e) {
		}
	},
	/**
	 * 根据商品ID取得剩余限抢数量
	 * 
	 * @param prodId
	 */
	getFlashSaleProdLeftNum : function(prodId) {
		try {
			$
					.post(
							Utils.contextPath
									+ '/InvokeServlet?methodName=GetLeftNum&prodId='
									+ prodId,
							function(data) {
								var html = "0";
								if (data.resultCode == "0") {
									html = data.result;
								}
								if (html == "0") {
									var targetObj = $("#flashTip");
									var flashTipTag = $("#flashTipTag");
									if (targetObj) {
										targetObj
												.html("<font color='red'><strong>已抢完</strong></font>");
										$("#flashSaleProdNum").val(html);
									}
									if (flashTipTag) {
										flashTipTag
												.html("<div class='icon_ticket_div3'></div>");

									}
								} else {
									var targetObj = $("#flashSaleProdLeftNumTip");
									if (targetObj) {
										// var prodStorageObj =
										// $("#prodStorage");
										// 如果剩余抢限数量大于库存数量
										// if (parseInt(html) >
										// parseInt(prodStorageObj
										// .val())) {
										// targetObj
										// .html(prodStorageObj.val());
										// $("#flashSaleProdNum").val(
										// prodStorageObj.val());
										// } else {
										// var
										// prodStorageTip=$("#prodStorageTip");
										targetObj.html(html);
										$("#flashSaleProdNum").val(html);
										// prodStorageObj.val(parseInt(html));
										// prodStorageTip.html(html);
										// }
									}
								}
							}, "json");
		} catch (e) {
		}
	},
	/**
	 * 导航对象分页处理方法
	 * 
	 * @param pageFrameObj
	 *            所有导航对象
	 * @param pageSize
	 *            每页记录数
	 * @param scrollObj
	 *            翻页对象
	 * @param action
	 *            初始化动作
	 */
	doPageableList : function(pageFrameObj, pageSize, scrollObj, action) {
		var curPage = pageFrameObj.attr("currentPage") == null ? 1
				: pageFrameObj.attr("currentPage");
		var total = pageFrameObj.find("li").size();
		var page = parseInt(total / pageSize) + (total % pageSize == 0 ? 0 : 1);
		if (curPage >= page) {
			scrollObj.css("className", "");
			return -1;
		} else if (curPage <= 1) {
			scrollObj.css("className", "");
			return 1;
		}
		// 页码处理
		if (scrollObj.attr("className") == "pv") {
			alert(curPage + 1);
			pageFrameObj.attr("currentPage", curPage + 1);
		} else if (scrollObj.attr("className") == "next") {
			alert(curPage - 1);
			pageFrameObj.attr("currentPage", curPage - 1);
		}
		return 0;
	},
	/**
	 * 根据区域编号取下级区域数据(海尔商品合并库存与运费查询用)
	 * 
	 * @param pid
	 * @param merchantProdId
	 * @param merchantId
	 */
	toGetSubAddress : function(pid, prodId,merchantProdId, merchantId, subTip,
			subMethod) {
		try {
			if (pid != "-1") {
				$.post(Utils.contextPath
						+ '/ZipUtilsServlet?type=staticmode&zipId=' + pid,
						function(data) {
							var resultList = data.resultSet;
							var html = "";
							if(subMethod==null||subMethod==""){
								subMethod="Utils.getProdStore";
							}
							for ( var i = 0; i < resultList.length; i++) {
								html += "<li onclick=\"" + subMethod + "(\'"
										+ resultList[i].id + "\',\'"
										+ resultList[i].name + "\',\'"
										+ merchantProdId  + "\',\'"
										+ prodId + "\',\'" + merchantId
										+ "\');\">" + resultList[i].name
										+ "</li>";
							}
							if(subTip==null||subTip==""){
								subTipe="subSelectedArearId";
							}
							var targetObj = $("#" + subTip);
							if (targetObj) {
								targetObj.html(html);
							}
						}, "json");
			}
		} catch (e) {
		}
	},
	/**
	 * 根据参数取商品区域库存及运费
	 * 
	 * @param areaId
	 * @param areaName
	 * @param merchantProdId
	 * @param merchantId
	 */
	getProdStoreAndFee : function(areaId, areaName,merchantProdId, prodId, merchantId) {
		//查询并显示库存
		try {
			var haierAreaId=$("#haierAreaId");
			if(haierAreaId){
				haierAreaId.val(areaId);
			}
			
			//判断是否为SKU商品
			var skuId=document.getElementById("shopCar.skuId").value;
			if(skuId!=""){
				merchantProdId=skuId;
			}
			
			var targetObj = $("#selectedAreaIdF");
			if (targetObj) {
				targetObj.html(areaName);
			}
			var targetImage = $("#prodStorageTip");
			var img = "<img src='"
					+ Utils.contextPath
					+ "/public/images/jbox/jbox-loading2.gif' width='15' height='15' border='0'/>";
			targetImage.html("库存："+img + "件&nbsp;&nbsp;&nbsp;|");
			$.post(Utils.contextPath
					+ '/InvokeServlet?methodName=GetProdStorage&areaId='
					+ areaId + '&prodId=' + merchantProdId + "&merchantId="
					+ merchantId, function(data) {
				var html = "0";
				if (data.resultCode == "0") {
					html = ""+data.result;
				}

				var targetObj = $("#prodStorageTip");
				if (targetObj) {
					if (html != "0") {
						targetObj.html("库存："+html + "件&nbsp;&nbsp;&nbsp;|");
					} else {
						targetObj.html("库存：缺货&nbsp;&nbsp;&nbsp;|");
					}
					$("#prodStorage").val(html);
				}
			}, "json");
		} catch (e) {
			var targetObj = $("#prodStorageTip");
			targetObj.html("库存：查询失败,请稍后再试.&nbsp;&nbsp;&nbsp;|");			
		}
		
		//查询并显示运费
		try {
			var targetObj = $("#selectedAreaIdF");
			if (targetObj) {
				targetObj.html(areaName);
			}
			var deliveryFeeResult = $("#deliveryFeeResult");
			var img = "<img src='"
					+ Utils.contextPath
					+ "/public/images/jbox/jbox-loading2.gif' width='15' height='15' border='0'/>";
			deliveryFeeResult.html(img + "正在查询运费...");
			
			var prodPriceByone=$('#prodPriceByone').val();
			if($('#flashSaleProdPrice').length>0){
				prodPriceByone=$('#flashSaleProdPrice').val();
			}

			$.post(Utils.contextPath
					+ '/InvokeServlet?methodName=GetProdDeliveryFee&areaId='
					+ areaId + '&prodId=' + prodId + "&merchantId="
					+ merchantId + '&prodPrice=' + prodPriceByone, function(data) {
				var targetObj = $("#deliveryFeeResult");
				if (data.resultCode == "0") {
					targetObj.html(data.resultSet);
				}else{
					targetObj.html("查询失败,请稍后再试.");
				}
			}, "json");
		} catch (e) {
			var targetObj = $("#deliveryFeeResult");
			targetObj.html("查询失败,请稍后再试.");
		}
	}
	
};